$(function () {
  /* 焦点图 */
  $.ajax({
    method: 'get',
    url: 'http://localhost:8080/api/v1/index/hotpic',
    data: {},
    success: (res) => {
      //console.log(res);
      const htmlStr = template('hot', res);
      $('.focus_list').html(htmlStr);
    }
  })

  /* 最新资讯*/
  $.ajax({
    method: '',
    url: 'http://localhost:8080/api/v1/index/latest',
    data: {},
    success: (res) => {
      //console.log(res);
      const htmlStr = template('news', res);
      $('.common_news').html(htmlStr);
    }
  })

  /* 热门模板 */
  $.ajax({
    method: 'get',
    url: 'http://localhost:8080/api/v1/index/rank',
    data: {},
    success: (res) => {
      //console.log(res);
      const htmlStr = template('rank', res);
      $('.hotrank_list').html(htmlStr);
    }
  })


  /* 最新评论 */
  $.ajax({
    method: 'get',
    url: 'http://localhost:8080/api/v1/index/latest_comment',
    data: {},
    success: (res) => {
      console.log(res);
      const htmlStr = template('comment', res);
      $('.comment_list').html(htmlStr);
    }
  })

  /* 焦点关注 */
  $.ajax({
    method: 'get',
    url: 'http://localhost:8080/api/v1/index/attention',
    data: {},
    success: (res) => {
      console.log(res);
      const htmlStr = template('guanzhuList', res);
      $('.guanzhu_list').html(htmlStr);
    }
  })
});